<template>
  <el-container>
    <el-header>
      <div class="top_box xq">
        <img
          style="cursor: pointer"
          @click="webopen()"
          src="../../assets/image/logo.png"
          alt=""
        />
      </div>
      <div class="title_bj_box xq"></div>
    </el-header>
    <el-main>
      <div class="jb_box jbxq_item_box">
        <div class="xq_tag_box back">
          <div class="xq_tab">{{ form.basic.name }}</div>
          <div class="back_box" @click="back()">返回</div>
        </div>
        <div class="item_box_jb">
          <div class="item_box_title">机构基本信息</div>
          <div class="top_jb">
            <el-descriptions :column="2" border>
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="机构名称："
                span="2"
                >{{ form.basic.name }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="法定代表人："
                >{{ form.basic.legal_name }}
              </el-descriptions-item>
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="会员登记号："
                >{{ form.basic.reg_code }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="社会统一信用代码："
                >{{ form.basic.unify_code }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="工商登记机关："
                >{{ form.basic.business }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="成立时间："
                >{{ form.basic.establishment_date }}</el-descriptions-item
              >
              <el-descriptions-item
                label-class-name="my-label_jb"
                content-class-name="my-content"
                label="注册资金(万元)："
                >{{ form.basic.reg_money }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="营业期限："
                >{{ form.basic.license_date }}</el-descriptions-item
              >
              <!-- <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="税务登记号："
                >{{ form.basic.tax }}</el-descriptions-item
              > -->
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="传真："
                >{{ form.basic.fax }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="办公电话："
                >{{ form.basic.mobile }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="通讯信箱："
                >{{ form.basic.email }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="邮政编码："
                >{{ form.basic.zip_code }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="注册地址："
                >{{ form.basic.address }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="土地登记代理机构证书号："
                >{{ form.basic.business_circles }}</el-descriptions-item
              >
              <el-descriptions-item
                content-class-name="my-content"
                label-class-name="my-label_jb"
                label="土地估价机构备案函号："
                >{{ form.basic.valuer_code }}</el-descriptions-item
              >
            </el-descriptions>
            
          </div>
        </div>
        <div class="item_box_jb">
          <div class="item_box_title">股东(合伙人)信息</div>
          <div class="zj_jb">
            <el-table :data="form.holder" stripe fit border>
              <el-table-column prop="name" label="姓名"> </el-table-column>

              <el-table-column prop="share_proportion" label="出资比例"> </el-table-column>

              <el-table-column prop="posttype" label="职务"> </el-table-column>
            </el-table>
          </div>
        </div>
        <div class="item_box_jb">
          <div class="item_box_title" v-if="this.$router.currentRoute.query.type==1" >
            土地估价师
          </div>
          <div class="item_box_title" v-else>
            登记代理人
          </div>
          <div class="zj_jb">
            <el-table :data="form.user" stripe fit border>
              <el-table-column prop="realname" label="姓名"> </el-table-column>
              <el-table-column prop="gender" label="性别">
                <template slot-scope="scope">
                  <span v-if="scope.row.gender == 1">男</span>
                  <span v-if="scope.row.gender == 0">女</span>
                </template>
              </el-table-column>

              <el-table-column
                v-if="this.$router.currentRoute.query.type == 1"
                prop="land_valuation_code"
                label="土地估价专业人员资格证书号"
              >
              </el-table-column>

              <el-table-column
                v-if="this.$router.currentRoute.query.type == 2"
                prop="registration_code"
                label="登记代理人证书号"
              >
              </el-table-column>

              <el-table-column label="操作" width="130">
                <template slot-scope="scope">
                  <el-button
                    type="primary"
                    style="background: #1954a4"
                    @click="handleClick(scope.row)"
                    >详情信息</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
        <div class="item_box_jb_t">
          <div class="item_box_title">附加信息</div>
          <div class="zj_jb">
            <el-table :data="form.other" stripe fit border>
              <el-table-column prop="name" label="姓名"> </el-table-column>
              <el-table-column prop="code" label="证书号码"> </el-table-column>
              <el-table-column prop="cert_images" label="附件">
                <template slot-scope="scope">
                  <el-image
                    v-if="
                      $self.pdimg($self.imgurl(scope.row.cert_images)) == 'img'
                    "
                    style="width: 1rem; height: 1rem"
                    :src="$self.imgurl(scope.row.cert_images)"
                    :preview-src-list="[$self.imgurl(scope.row.cert_images)]"
                  >
                  </el-image>
                  <el-button
                    v-if="
                      $self.pdimg($self.imgurl(scope.row.cert_images)) == 'pdf'
                    "
                    type="primary"
                    style="background: #1954a4"
                    @click="openDialog($self.imgurl(scope.row.cert_images))"
                    >查看</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </div>
    </el-main>
    <el-footer>
      <foot></foot>
    </el-footer>
  </el-container>
</template>

<script>
import tab from "../../components/tab.vue";
import foot from "../../components/foot.vue";
import env from "@/../env.js";

export default {
  data() {
    return {
      tableData: [],
      form: {
        basic: {}, //不定义会报错
      },
      url: env.API_BASE_URL,
    };
  },
  components: {
    tabVue: tab,
    foot: foot,
  },
  created() {
    this.getinfo();
  },
  mounted() {},
  methods: {
    webopen() {
      window.open(this.url);
    },
    openDialog(e) {
      window.open(e);
    },
    back() {
      this.$router.go(-1);
    },
    /**
     * 获取列表
     */
    getinfo() {
      let that = this;
      let data = {
        id: this.$router.currentRoute.query.id,
        type: this.$router.currentRoute.query.type
          ? this.$router.currentRoute.query.type
          : "",
      };
      // console.log(JSON.stringify(data))
      that.$http.post("mechanism/mechanism_view", data).then((res) => {
        that.form = res.data;
      });
    },
    /**
     * 查看详情
     */
    handleClick(e) {
      this.$router.push({ path: "/cxxq", query: { id: e.id } });
    },
    //表格斑马纹
    tableRowClassName({ row, rowIndex }) {
      console.log({ row, rowIndex });
      let n;
      if (rowIndex === 0 || rowIndex === 2 * n) {
        return "warning-row";
      } else if (rowIndex === 2 * n - 1) {
        return "success-row";
      }
      return "";
    },
    //  ==
  },
};
</script>
<style>
.el-table .warning-row {
  background: #fafafa;
}

.el-table .success-row {
  background: #fff;
}
</style>
<style>
.el-header {
  margin: 0%;
  padding: 0;
  height: auto !important;
  width: auto;
}
.el-card__body,
.el-main {
  margin: 0%;
  padding: 0%;
  min-height: calc(100vh - 7.22rem);
}
.top_box {
  background-image: url("../../assets/image/首页顶部背景.jpg");
  background-size: 100% 100%;
  height: 1.75rem;
  width: 100%;
  display: flex;
  align-items: center;
}
.top_box img {
  width: 10rem;
  margin-left: 4.3rem;
}
.jbxq_item_box .title_bj_box {
  background-image: url("../../assets/image/2f76a6a5ed5416122abcda8e6ae6529.png");
  background-size: 100% 100%;
  height: 2rem !important;
}

.jb_box {
  width: 15rem;
  background: #ffffff;
  border-radius: 0.125rem;
  margin: 0.75rem auto 1.25rem;
  box-shadow: 1px 1px 3px 2px rgba(0, 0, 0, 0.15);
}
.xq_tag_box {
  border-bottom: solid 0.0375rem #1954a4;
  display: flex;
  align-items: center;
  height: 0.75rem;
  padding-left: 0.25rem;
  box-sizing: border-box;
}
.xq_tab {
  border-left: solid 0.075rem #1954a4;
  font-size: 20px;
  font-weight: 400;
  color: #1954a4;
  padding-left: 0.2125rem;
  box-sizing: border-box;
}
.item_box_jb {
  padding: 0.4125rem 0.2375rem 0;
}
.item_box_jb_t {
  padding: 0.4125rem 0.2375rem;
}
.item_box_title {
  height: 40px;
  font-size: 16px;
  font-weight: bold;
  color: #ffffff;
  background: #1954a4;
  padding-left: 0.3375rem;
  box-sizing: border-box;
  letter-spacing: 0.021rem;
  display: flex;
  align-items: center;
}
.my-label_jb {
  width: 2.3rem;
  text-align: end !important;
  border-right: none !important;
  background: #fff !important;
  font-size: 16px;
  color: #333 !important;
}

.top_jb tbody:nth-child(even) {
  background: #f2f2f2 !important;
}
.top_jb tbody:nth-child(even) .el-descriptions-item__label.is-bordered-label {
  background: #f2f2f2 !important;
}
.top_jb tbody td {
  border-left: none !important;
}
.my-content {
  width: 5.6rem;
  font-size: 16px;
  color: #333 !important;
}
.zj_jb
  .el-table--striped
  .el-table__body
  tr.el-table__row--striped
  td.el-table__cell {
  /* background: #f2f2f2 !important; */
  background: #fff !important;
}
.zj_jb .el-table tr {
  /* background: #f2f2f2 !important; */
  background: #f2f2f2 !important;
}
.zj_jb .el-table__header thead th {
  text-align: center;
  color: #1954a4;
  font-size: 16px;
}
.zj_jb .el-table__body-wrapper tbody td {
  text-align: center;
  font-size: 16px;
  color: #333 !important;
}
.pagination_jb {
  margin: 3% auto 0%;
  text-align: center;
}
.pagination_jb .el-pagination.is-background .el-pager li:not(.disabled).active {
  background-color: #1954a4;
}
</style>
<style scoped>
.back {
  display: flex;
  justify-content: space-between;
  padding-right: 0.35rem;
}
.back_box {
  font-size: 18px;
  color: #1954a4;
  cursor: pointer;
}
</style>
